
_fibonacci:     file format elf32-i386


Disassembly of section .text:

00000000 <numToString>:


static char tempname[128];
static char newString[20];

void numToString(int num){
   0:	55                   	push   %ebp
   1:	89 e5                	mov    %esp,%ebp
   3:	57                   	push   %edi
   4:	56                   	push   %esi
		newString[0]= 48;
		newString[1]=0;
	}
	else{
		while (num!=0){
			num = num/10;
   5:	be 67 66 66 66       	mov    $0x66666667,%esi


static char tempname[128];
static char newString[20];

void numToString(int num){
   a:	53                   	push   %ebx
	int i;
	//int j = 0;
	int count = 0; //will hold the number of digits in num
	if (num==0) {
		newString[0]= 48;
		newString[1]=0;
   b:	8b 4d 08             	mov    0x8(%ebp),%ecx
   e:	31 db                	xor    %ebx,%ebx
void numToString(int num){
	int num2 = num;
	int i;
	//int j = 0;
	int count = 0; //will hold the number of digits in num
	if (num==0) {
  10:	85 c9                	test   %ecx,%ecx
  12:	75 06                	jne    1a <numToString+0x1a>
  14:	eb 5d                	jmp    73 <numToString+0x73>
  16:	66 90                	xchg   %ax,%ax
		newString[0]= 48;
		newString[1]=0;
	}
	else{
		while (num!=0){
  18:	89 fb                	mov    %edi,%ebx
			num = num/10;
  1a:	89 c8                	mov    %ecx,%eax
  1c:	f7 ee                	imul   %esi
  1e:	c1 f9 1f             	sar    $0x1f,%ecx
			count = count+1;
  21:	8d 7b 01             	lea    0x1(%ebx),%edi
		newString[0]= 48;
		newString[1]=0;
	}
	else{
		while (num!=0){
			num = num/10;
  24:	c1 fa 02             	sar    $0x2,%edx
	if (num==0) {
		newString[0]= 48;
		newString[1]=0;
	}
	else{
		while (num!=0){
  27:	29 ca                	sub    %ecx,%edx
  29:	89 d1                	mov    %edx,%ecx
  2b:	75 eb                	jne    18 <numToString+0x18>


static char tempname[128];
static char newString[20];

void numToString(int num){
  2d:	8b 4d 08             	mov    0x8(%ebp),%ecx
	if (num==0) {
		newString[0]= 48;
		newString[1]=0;
	}
	else{
		while (num!=0){
  30:	81 c3 40 0e 00 00    	add    $0xe40,%ebx
			count = count+1;
		}
	

		for (i = count-1; i>=0; i--){
			newString[i]= (num2 % 10) + 48;	
  36:	be 67 66 66 66       	mov    $0x66666667,%esi
  3b:	90                   	nop
  3c:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  40:	89 c8                	mov    %ecx,%eax
  42:	f7 ee                	imul   %esi
  44:	89 c8                	mov    %ecx,%eax
  46:	c1 f8 1f             	sar    $0x1f,%eax
  49:	c1 fa 02             	sar    $0x2,%edx
  4c:	29 c2                	sub    %eax,%edx
  4e:	8d 04 92             	lea    (%edx,%edx,4),%eax
  51:	01 c0                	add    %eax,%eax
  53:	29 c1                	sub    %eax,%ecx
  55:	83 c1 30             	add    $0x30,%ecx
  58:	88 0b                	mov    %cl,(%ebx)
			num2 = num2 / 10;
  5a:	83 eb 01             	sub    $0x1,%ebx
  5d:	89 d1                	mov    %edx,%ecx
			num = num/10;
			count = count+1;
		}
	

		for (i = count-1; i>=0; i--){
  5f:	81 fb 3f 0e 00 00    	cmp    $0xe3f,%ebx
  65:	75 d9                	jne    40 <numToString+0x40>
			newString[i]= (num2 % 10) + 48;	
			num2 = num2 / 10;
		}
		newString[count]=0;
  67:	c6 87 40 0e 00 00 00 	movb   $0x0,0xe40(%edi)
	}
}
  6e:	5b                   	pop    %ebx
  6f:	5e                   	pop    %esi
  70:	5f                   	pop    %edi
  71:	5d                   	pop    %ebp
  72:	c3                   	ret    
  73:	5b                   	pop    %ebx
	int num2 = num;
	int i;
	//int j = 0;
	int count = 0; //will hold the number of digits in num
	if (num==0) {
		newString[0]= 48;
  74:	c6 05 40 0e 00 00 30 	movb   $0x30,0xe40
			newString[i]= (num2 % 10) + 48;	
			num2 = num2 / 10;
		}
		newString[count]=0;
	}
}
  7b:	5e                   	pop    %esi
	int i;
	//int j = 0;
	int count = 0; //will hold the number of digits in num
	if (num==0) {
		newString[0]= 48;
		newString[1]=0;
  7c:	c6 05 41 0e 00 00 00 	movb   $0x0,0xe41
			newString[i]= (num2 % 10) + 48;	
			num2 = num2 / 10;
		}
		newString[count]=0;
	}
}
  83:	5f                   	pop    %edi
  84:	5d                   	pop    %ebp
  85:	c3                   	ret    
  86:	8d 76 00             	lea    0x0(%esi),%esi
  89:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

00000090 <shirshur>:


void
shirshur(char* p2){
  90:	55                   	push   %ebp
  91:	89 e5                	mov    %esp,%ebp
  93:	83 ec 28             	sub    $0x28,%esp

	char* p1 = "FibTest<";
	char* p3 = ">.txt";

	int l1 = strlen(p1);
  96:	c7 04 24 c0 0c 00 00 	movl   $0xcc0,(%esp)
	}
}


void
shirshur(char* p2){
  9d:	89 5d f4             	mov    %ebx,-0xc(%ebp)
  a0:	89 75 f8             	mov    %esi,-0x8(%ebp)
  a3:	8b 75 08             	mov    0x8(%ebp),%esi
  a6:	89 7d fc             	mov    %edi,-0x4(%ebp)

	char* p1 = "FibTest<";
	char* p3 = ">.txt";

	int l1 = strlen(p1);
  a9:	e8 92 05 00 00       	call   640 <strlen>
	int l2 = strlen(p2);
  ae:	89 34 24             	mov    %esi,(%esp)
shirshur(char* p2){

	char* p1 = "FibTest<";
	char* p3 = ">.txt";

	int l1 = strlen(p1);
  b1:	89 c3                	mov    %eax,%ebx
	int l2 = strlen(p2);
  b3:	e8 88 05 00 00       	call   640 <strlen>

	strcpy(tempname, p1);
  b8:	c7 44 24 04 c0 0c 00 	movl   $0xcc0,0x4(%esp)
  bf:	00 
  c0:	c7 04 24 c0 0d 00 00 	movl   $0xdc0,(%esp)

	char* p1 = "FibTest<";
	char* p3 = ">.txt";

	int l1 = strlen(p1);
	int l2 = strlen(p2);
  c7:	89 c7                	mov    %eax,%edi

	strcpy(tempname, p1);
  c9:	e8 f2 04 00 00       	call   5c0 <strcpy>
	strcpy(tempname + l1, p2);
  ce:	8d 83 c0 0d 00 00    	lea    0xdc0(%ebx),%eax
  d4:	89 74 24 04          	mov    %esi,0x4(%esp)
  d8:	89 04 24             	mov    %eax,(%esp)
  db:	e8 e0 04 00 00       	call   5c0 <strcpy>
	strcpy(tempname + l1 + l2, p3);
  e0:	8d 84 1f c0 0d 00 00 	lea    0xdc0(%edi,%ebx,1),%eax
  e7:	c7 44 24 04 c9 0c 00 	movl   $0xcc9,0x4(%esp)
  ee:	00 
  ef:	89 04 24             	mov    %eax,(%esp)
  f2:	e8 c9 04 00 00       	call   5c0 <strcpy>
}
  f7:	8b 5d f4             	mov    -0xc(%ebp),%ebx
  fa:	8b 75 f8             	mov    -0x8(%ebp),%esi
  fd:	8b 7d fc             	mov    -0x4(%ebp),%edi
 100:	89 ec                	mov    %ebp,%esp
 102:	5d                   	pop    %ebp
 103:	c3                   	ret    
 104:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
 10a:	8d bf 00 00 00 00    	lea    0x0(%edi),%edi

00000110 <main>:

int
main(int argc, char *argv[]){
 110:	8d 4c 24 04          	lea    0x4(%esp),%ecx
 114:	83 e4 f0             	and    $0xfffffff0,%esp
 117:	ff 71 fc             	pushl  -0x4(%ecx)
 11a:	55                   	push   %ebp
 11b:	89 e5                	mov    %esp,%ebp
 11d:	57                   	push   %edi
 11e:	56                   	push   %esi
 11f:	53                   	push   %ebx
 120:	51                   	push   %ecx
 121:	81 ec 18 01 00 00    	sub    $0x118,%esp
 127:	8b 41 04             	mov    0x4(%ecx),%eax

// numToString(atoi(argv[1]));
// shirshur(newString);
// printf(1, tempname);
// exit();
	int numOfElem = atoi(argv[1]);
 12a:	8b 40 04             	mov    0x4(%eax),%eax
 12d:	89 04 24             	mov    %eax,(%esp)
 130:	e8 8b 05 00 00       	call   6c0 <atoi>
 135:	89 c3                	mov    %eax,%ebx
	int pid=-1;
	int cid;
//	int j;
	int wtime;
	int rtime;
	int wtimes[numOfElem];
 137:	8d 04 85 1e 00 00 00 	lea    0x1e(,%eax,4),%eax
 13e:	83 e0 f0             	and    $0xfffffff0,%eax
 141:	29 c4                	sub    %eax,%esp
 143:	8d 7c 24 23          	lea    0x23(%esp),%edi
	int rtimes[numOfElem];
 147:	29 c4                	sub    %eax,%esp
 149:	8d 74 24 23          	lea    0x23(%esp),%esi
	int pid=-1;
	int cid;
//	int j;
	int wtime;
	int rtime;
	int wtimes[numOfElem];
 14d:	83 e7 f0             	and    $0xfffffff0,%edi
	int rtimes[numOfElem];
 150:	83 e6 f0             	and    $0xfffffff0,%esi
	int flag = 0; // will hold how many numbers read from file
//	char* filename;

				
				
	for (i=0; i<numOfElem; i++){
 153:	85 db                	test   %ebx,%ebx
 155:	0f 8e 69 03 00 00    	jle    4c4 <main+0x3b4>
 15b:	89 b5 04 ff ff ff    	mov    %esi,-0xfc(%ebp)
 161:	89 de                	mov    %ebx,%esi
 163:	31 db                	xor    %ebx,%ebx
 165:	c7 85 00 ff ff ff 00 	movl   $0x0,-0x100(%ebp)
 16c:	00 00 00 
 16f:	eb 12                	jmp    183 <main+0x73>
 171:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
 178:	83 c3 01             	add    $0x1,%ebx
 17b:	39 de                	cmp    %ebx,%esi
 17d:	0f 8e 0b 02 00 00    	jle    38e <main+0x27e>
		if((pid=fork())==0) {
 183:	e8 58 06 00 00       	call   7e0 <fork>
 188:	85 c0                	test   %eax,%eax
 18a:	75 ec                	jne    178 <main+0x68>
			cid = i;
			if ((cid % 2) == 1) {
 18c:	f6 c3 01             	test   $0x1,%bl
 18f:	89 9d 00 ff ff ff    	mov    %ebx,-0x100(%ebp)
 195:	0f 85 d0 01 00 00    	jne    36b <main+0x25b>
					fst = tmp;
				}
			}
			else {
				
				numToString(cid);
 19b:	89 1c 24             	mov    %ebx,(%esp)
 19e:	8d 7d e6             	lea    -0x1a(%ebp),%edi
 1a1:	e8 5a fe ff ff       	call   0 <numToString>
				shirshur(newString);
 1a6:	c7 04 24 40 0e 00 00 	movl   $0xe40,(%esp)
 1ad:	e8 de fe ff ff       	call   90 <shirshur>
				fd = open(tempname, O_CREATE | O_RDWR);
 1b2:	c7 44 24 04 02 02 00 	movl   $0x202,0x4(%esp)
 1b9:	00 
 1ba:	c7 04 24 c0 0d 00 00 	movl   $0xdc0,(%esp)
 1c1:	e8 62 06 00 00       	call   828 <open>
 1c6:	c7 85 04 ff ff ff 00 	movl   $0x0,-0xfc(%ebp)
 1cd:	00 00 00 
 1d0:	89 c3                	mov    %eax,%ebx
 1d2:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
				for (k = 0; k <= cid; k++){
					if (k==0){
 1d8:	8b 85 04 ff ff ff    	mov    -0xfc(%ebp),%eax
 1de:	85 c0                	test   %eax,%eax
 1e0:	0f 84 3a 03 00 00    	je     520 <main+0x410>
						write(fd, "0", 1);
						close(fd);
						printf(1, "FibTest<%d> <%d>,<%d>\n", cid, 0, 0);
					}
					if (k==1){
 1e6:	83 bd 04 ff ff ff 01 	cmpl   $0x1,-0xfc(%ebp)
 1ed:	0f 84 62 03 00 00    	je     555 <main+0x445>
						close(fd);
						printf(1, "FibTest<%d> <%d>,<%d>\n", cid, 0, 1);
						
					}
					if (k > 1) { //not base cases
						fd = open(tempname, O_RDONLY);
 1f3:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
 1fa:	00 
 1fb:	c7 04 24 c0 0d 00 00 	movl   $0xdc0,(%esp)
 202:	e8 21 06 00 00       	call   828 <open>
 207:	31 d2                	xor    %edx,%edx
 209:	89 d3                	mov    %edx,%ebx
 20b:	89 c6                	mov    %eax,%esi
 20d:	8d 76 00             	lea    0x0(%esi),%esi
						for (m=0; ((flag < 1) && (m < 100)); m++ ){
							read(fd, temp, 1);
 210:	c7 44 24 08 01 00 00 	movl   $0x1,0x8(%esp)
 217:	00 
 218:	89 7c 24 04          	mov    %edi,0x4(%esp)
 21c:	89 34 24             	mov    %esi,(%esp)
 21f:	e8 dc 05 00 00       	call   800 <read>
							if (temp[0] != '\n'){
 224:	0f b6 45 e6          	movzbl -0x1a(%ebp),%eax
 228:	3c 0a                	cmp    $0xa,%al
 22a:	0f 84 a0 02 00 00    	je     4d0 <main+0x3c0>
								n1[m] = temp[0];
 230:	88 84 1d 78 ff ff ff 	mov    %al,-0x88(%ebp,%ebx,1)
						printf(1, "FibTest<%d> <%d>,<%d>\n", cid, 0, 1);
						
					}
					if (k > 1) { //not base cases
						fd = open(tempname, O_RDONLY);
						for (m=0; ((flag < 1) && (m < 100)); m++ ){
 237:	83 c3 01             	add    $0x1,%ebx
 23a:	83 fb 64             	cmp    $0x64,%ebx
 23d:	75 d1                	jne    210 <main+0x100>
 23f:	89 f3                	mov    %esi,%ebx
 241:	e9 96 02 00 00       	jmp    4dc <main+0x3cc>
 246:	66 90                	xchg   %ax,%ax
 248:	89 da                	mov    %ebx,%edx
 24a:	89 f3                	mov    %esi,%ebx
								n2[m]=temp[0];
								//printf(1, "hiiiiiiiiiiiii    %s", temp);
							}
							else{
								flag = 2;
								n2[m]=0;
 24c:	c6 84 15 14 ff ff ff 	movb   $0x0,-0xec(%ebp,%edx,1)
 253:	00 
							}
						}
						
						//now n1 and n2 hold the string of the numbers in the file
						num1 = atoi(n1);
 254:	8d 85 78 ff ff ff    	lea    -0x88(%ebp),%eax
 25a:	89 04 24             	mov    %eax,(%esp)
 25d:	e8 5e 04 00 00       	call   6c0 <atoi>
						num2 = atoi(n2);
 262:	8d 95 14 ff ff ff    	lea    -0xec(%ebp),%edx
 268:	89 14 24             	mov    %edx,(%esp)
								n2[m]=0;
							}
						}
						
						//now n1 and n2 hold the string of the numbers in the file
						num1 = atoi(n1);
 26b:	89 c6                	mov    %eax,%esi
						num2 = atoi(n2);
 26d:	e8 4e 04 00 00       	call   6c0 <atoi>
						
						tmp = num2;
						num2 = num1 + num2;
						num1 = tmp;
						
						close(fd);
 272:	89 1c 24             	mov    %ebx,(%esp)
						//now n1 and n2 hold the string of the numbers in the file
						num1 = atoi(n1);
						num2 = atoi(n2);
						
						tmp = num2;
						num2 = num1 + num2;
 275:	01 c6                	add    %eax,%esi
							}
						}
						
						//now n1 and n2 hold the string of the numbers in the file
						num1 = atoi(n1);
						num2 = atoi(n2);
 277:	89 85 fc fe ff ff    	mov    %eax,-0x104(%ebp)
						
						tmp = num2;
						num2 = num1 + num2;
						num1 = tmp;
						
						close(fd);
 27d:	e8 8e 05 00 00       	call   810 <close>
						fd = open(tempname, O_RDWR);
 282:	c7 44 24 04 02 00 00 	movl   $0x2,0x4(%esp)
 289:	00 
 28a:	c7 04 24 c0 0d 00 00 	movl   $0xdc0,(%esp)
 291:	e8 92 05 00 00       	call   828 <open>
 296:	89 c3                	mov    %eax,%ebx
						numToString(num1);
 298:	8b 85 fc fe ff ff    	mov    -0x104(%ebp),%eax
 29e:	89 04 24             	mov    %eax,(%esp)
 2a1:	e8 5a fd ff ff       	call   0 <numToString>
						write(fd, newString, strlen(newString));
 2a6:	c7 04 24 40 0e 00 00 	movl   $0xe40,(%esp)
 2ad:	e8 8e 03 00 00       	call   640 <strlen>
 2b2:	c7 44 24 04 40 0e 00 	movl   $0xe40,0x4(%esp)
 2b9:	00 
 2ba:	89 1c 24             	mov    %ebx,(%esp)
 2bd:	89 44 24 08          	mov    %eax,0x8(%esp)
 2c1:	e8 42 05 00 00       	call   808 <write>
						write(fd, "\n",1);
 2c6:	c7 44 24 08 01 00 00 	movl   $0x1,0x8(%esp)
 2cd:	00 
 2ce:	c7 44 24 04 eb 0c 00 	movl   $0xceb,0x4(%esp)
 2d5:	00 
 2d6:	89 1c 24             	mov    %ebx,(%esp)
 2d9:	e8 2a 05 00 00       	call   808 <write>
						numToString(num2);
 2de:	89 34 24             	mov    %esi,(%esp)
 2e1:	e8 1a fd ff ff       	call   0 <numToString>
						write(fd, newString, strlen(newString));
 2e6:	c7 04 24 40 0e 00 00 	movl   $0xe40,(%esp)
 2ed:	e8 4e 03 00 00       	call   640 <strlen>
 2f2:	c7 44 24 04 40 0e 00 	movl   $0xe40,0x4(%esp)
 2f9:	00 
 2fa:	89 1c 24             	mov    %ebx,(%esp)
 2fd:	89 44 24 08          	mov    %eax,0x8(%esp)
 301:	e8 02 05 00 00       	call   808 <write>
						write(fd, "\n",1);
 306:	c7 44 24 08 01 00 00 	movl   $0x1,0x8(%esp)
 30d:	00 
 30e:	c7 44 24 04 eb 0c 00 	movl   $0xceb,0x4(%esp)
 315:	00 
 316:	89 1c 24             	mov    %ebx,(%esp)
 319:	e8 ea 04 00 00       	call   808 <write>

						close(fd);
 31e:	89 1c 24             	mov    %ebx,(%esp)
 321:	e8 ea 04 00 00       	call   810 <close>
						printf(1, "FibTest<%d> <%d>,<%d>\n", cid, num1, num2);
 326:	8b 95 fc fe ff ff    	mov    -0x104(%ebp),%edx
 32c:	89 74 24 10          	mov    %esi,0x10(%esp)
 330:	89 54 24 0c          	mov    %edx,0xc(%esp)
 334:	8b 85 00 ff ff ff    	mov    -0x100(%ebp),%eax
 33a:	c7 44 24 04 d1 0c 00 	movl   $0xcd1,0x4(%esp)
 341:	00 
 342:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
 349:	89 44 24 08          	mov    %eax,0x8(%esp)
 34d:	e8 ee 05 00 00       	call   940 <printf>
			else {
				
				numToString(cid);
				shirshur(newString);
				fd = open(tempname, O_CREATE | O_RDWR);
				for (k = 0; k <= cid; k++){
 352:	83 85 04 ff ff ff 01 	addl   $0x1,-0xfc(%ebp)
 359:	8b 95 00 ff ff ff    	mov    -0x100(%ebp),%edx
 35f:	39 95 04 ff ff ff    	cmp    %edx,-0xfc(%ebp)
 365:	0f 8e 6d fe ff ff    	jle    1d8 <main+0xc8>


			
			
			}
			printf(1, "FibTest: proc %d finished its calculation\n", cid);
 36b:	8b 85 00 ff ff ff    	mov    -0x100(%ebp),%eax
 371:	c7 44 24 04 40 0d 00 	movl   $0xd40,0x4(%esp)
 378:	00 
 379:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
 380:	89 44 24 08          	mov    %eax,0x8(%esp)
 384:	e8 b7 05 00 00       	call   940 <printf>
			exit();
 389:	e8 5a 04 00 00       	call   7e8 <exit>
		}
	}


	if (pid > 0){
 38e:	85 c0                	test   %eax,%eax
 390:	0f 8e 2e 01 00 00    	jle    4c4 <main+0x3b4>
 396:	31 d2                	xor    %edx,%edx
 398:	89 d3                	mov    %edx,%ebx
 39a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
		for (counter = 0; counter<numOfElem; counter++){
			wait2(&wtime, &rtime);
 3a0:	8d 55 dc             	lea    -0x24(%ebp),%edx
 3a3:	8d 45 e0             	lea    -0x20(%ebp),%eax
 3a6:	89 54 24 04          	mov    %edx,0x4(%esp)
 3aa:	89 04 24             	mov    %eax,(%esp)
 3ad:	e8 d6 04 00 00       	call   888 <wait2>
			wtimes[counter] = wtime;
 3b2:	8b 45 e0             	mov    -0x20(%ebp),%eax
 3b5:	89 04 9f             	mov    %eax,(%edi,%ebx,4)
			rtimes[counter] = rtime;
 3b8:	8b 45 dc             	mov    -0x24(%ebp),%eax
 3bb:	8b 95 04 ff ff ff    	mov    -0xfc(%ebp),%edx
 3c1:	89 04 9a             	mov    %eax,(%edx,%ebx,4)
		}
	}


	if (pid > 0){
		for (counter = 0; counter<numOfElem; counter++){
 3c4:	83 c3 01             	add    $0x1,%ebx
 3c7:	39 de                	cmp    %ebx,%esi
 3c9:	7f d5                	jg     3a0 <main+0x290>
 3cb:	89 f3                	mov    %esi,%ebx
 3cd:	31 c0                	xor    %eax,%eax
 3cf:	89 d6                	mov    %edx,%esi
 3d1:	31 c9                	xor    %ecx,%ecx
 3d3:	c7 85 04 ff ff ff 00 	movl   $0x0,-0xfc(%ebp)
 3da:	00 00 00 
 3dd:	c7 85 00 ff ff ff 00 	movl   $0x0,-0x100(%ebp)
 3e4:	00 00 00 
 3e7:	89 9d fc fe ff ff    	mov    %ebx,-0x104(%ebp)
 3ed:	8d 76 00             	lea    0x0(%esi),%esi
			wtimes[counter] = wtime;
			rtimes[counter] = rtime;
		}
		
		for (counter = 0; counter<numOfElem; counter++){
			avgwtime = avgwtime + wtimes[counter];
 3f0:	8b 14 87             	mov    (%edi,%eax,4),%edx
			avgrtime = avgrtime + rtimes[counter];
 3f3:	8b 1c 86             	mov    (%esi,%eax,4),%ebx
			wait2(&wtime, &rtime);
			wtimes[counter] = wtime;
			rtimes[counter] = rtime;
		}
		
		for (counter = 0; counter<numOfElem; counter++){
 3f6:	83 c0 01             	add    $0x1,%eax
			avgwtime = avgwtime + wtimes[counter];
			avgrtime = avgrtime + rtimes[counter];
 3f9:	01 9d 00 ff ff ff    	add    %ebx,-0x100(%ebp)
			wtimes[counter] = wtime;
			rtimes[counter] = rtime;
		}
		
		for (counter = 0; counter<numOfElem; counter++){
			avgwtime = avgwtime + wtimes[counter];
 3ff:	01 d1                	add    %edx,%ecx
			avgrtime = avgrtime + rtimes[counter];
			avgttime = avgttime + rtimes[counter] + wtimes[counter];
 401:	8d 14 13             	lea    (%ebx,%edx,1),%edx
 404:	01 95 04 ff ff ff    	add    %edx,-0xfc(%ebp)
			wait2(&wtime, &rtime);
			wtimes[counter] = wtime;
			rtimes[counter] = rtime;
		}
		
		for (counter = 0; counter<numOfElem; counter++){
 40a:	3b 85 fc fe ff ff    	cmp    -0x104(%ebp),%eax
 410:	75 de                	jne    3f0 <main+0x2e0>
 412:	8b 9d fc fe ff ff    	mov    -0x104(%ebp),%ebx
		
		avgwtime = avgwtime / numOfElem;
		avgrtime = avgrtime / numOfElem;
		avgttime = avgttime / numOfElem;
		
		printf(1, "Average waiting time: %d\n", avgwtime);
 418:	89 ca                	mov    %ecx,%edx
 41a:	89 c8                	mov    %ecx,%eax
 41c:	c1 fa 1f             	sar    $0x1f,%edx
 41f:	c7 44 24 04 ed 0c 00 	movl   $0xced,0x4(%esp)
 426:	00 
 427:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
 42e:	f7 fb                	idiv   %ebx
 430:	89 44 24 08          	mov    %eax,0x8(%esp)
 434:	e8 07 05 00 00       	call   940 <printf>
		printf(1, "Average running time: %d\n", avgrtime);
 439:	8b 95 00 ff ff ff    	mov    -0x100(%ebp),%edx
 43f:	c7 44 24 04 07 0d 00 	movl   $0xd07,0x4(%esp)
 446:	00 
 447:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
 44e:	89 d0                	mov    %edx,%eax
 450:	c1 fa 1f             	sar    $0x1f,%edx
 453:	f7 fb                	idiv   %ebx
 455:	89 44 24 08          	mov    %eax,0x8(%esp)
 459:	e8 e2 04 00 00       	call   940 <printf>
		printf(1, "Average turnaround time: %d\n", avgttime);
 45e:	8b 95 04 ff ff ff    	mov    -0xfc(%ebp),%edx
 464:	c7 44 24 04 21 0d 00 	movl   $0xd21,0x4(%esp)
 46b:	00 
 46c:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
 473:	89 d0                	mov    %edx,%eax
 475:	c1 fa 1f             	sar    $0x1f,%edx
 478:	f7 fb                	idiv   %ebx
 47a:	89 44 24 08          	mov    %eax,0x8(%esp)
 47e:	e8 bd 04 00 00       	call   940 <printf>
 483:	31 c0                	xor    %eax,%eax
 485:	89 9d 04 ff ff ff    	mov    %ebx,-0xfc(%ebp)
 48b:	89 c3                	mov    %eax,%ebx
 48d:	8d 76 00             	lea    0x0(%esi),%esi
		
		for (counter = 0; counter<numOfElem; counter++){
			ttime = wtimes[counter] + rtimes[counter];
 490:	8b 04 9f             	mov    (%edi,%ebx,4),%eax
 493:	8b 14 9e             	mov    (%esi,%ebx,4),%edx
		
		printf(1, "Average waiting time: %d\n", avgwtime);
		printf(1, "Average running time: %d\n", avgrtime);
		printf(1, "Average turnaround time: %d\n", avgttime);
		
		for (counter = 0; counter<numOfElem; counter++){
 496:	83 c3 01             	add    $0x1,%ebx
			ttime = wtimes[counter] + rtimes[counter];
			printf(1, "Waiting: %d , Running: %d , Turnaround: %d \n",  wtimes[counter], rtimes[counter], ttime);
 499:	c7 44 24 04 6c 0d 00 	movl   $0xd6c,0x4(%esp)
 4a0:	00 
 4a1:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
 4a8:	89 44 24 08          	mov    %eax,0x8(%esp)
 4ac:	8d 0c 02             	lea    (%edx,%eax,1),%ecx
 4af:	89 4c 24 10          	mov    %ecx,0x10(%esp)
 4b3:	89 54 24 0c          	mov    %edx,0xc(%esp)
 4b7:	e8 84 04 00 00       	call   940 <printf>
		
		printf(1, "Average waiting time: %d\n", avgwtime);
		printf(1, "Average running time: %d\n", avgrtime);
		printf(1, "Average turnaround time: %d\n", avgttime);
		
		for (counter = 0; counter<numOfElem; counter++){
 4bc:	39 9d 04 ff ff ff    	cmp    %ebx,-0xfc(%ebp)
 4c2:	7f cc                	jg     490 <main+0x380>
			ttime = wtimes[counter] + rtimes[counter];
			printf(1, "Waiting: %d , Running: %d , Turnaround: %d \n",  wtimes[counter], rtimes[counter], ttime);
		}
    }    
  exit();
 4c4:	e8 1f 03 00 00       	call   7e8 <exit>
 4c9:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
 4d0:	89 da                	mov    %ebx,%edx
 4d2:	89 f3                	mov    %esi,%ebx
								n1[m] = temp[0];
// 								printf(1, "hiiiiiiiiiiiii    %s", &n1[m]);
							}
							else {
								flag = 1;
								n1[m] = 0;
 4d4:	c6 84 15 78 ff ff ff 	movb   $0x0,-0x88(%ebp,%edx,1)
 4db:	00 
 4dc:	31 d2                	xor    %edx,%edx
 4de:	89 de                	mov    %ebx,%esi
 4e0:	89 d3                	mov    %edx,%ebx
 4e2:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
							}
						}
						//printf(1, "hiiiiiiiiiiiii    %s", temp);
						for (m=0; (flag < 2) && (m < 100) ; m++ ){
							read(fd, temp, 1);
 4e8:	c7 44 24 08 01 00 00 	movl   $0x1,0x8(%esp)
 4ef:	00 
 4f0:	89 7c 24 04          	mov    %edi,0x4(%esp)
 4f4:	89 34 24             	mov    %esi,(%esp)
 4f7:	e8 04 03 00 00       	call   800 <read>
							if(temp[0] != '\n'){
 4fc:	0f b6 45 e6          	movzbl -0x1a(%ebp),%eax
 500:	3c 0a                	cmp    $0xa,%al
 502:	0f 84 40 fd ff ff    	je     248 <main+0x138>
								n2[m]=temp[0];
 508:	88 84 1d 14 ff ff ff 	mov    %al,-0xec(%ebp,%ebx,1)
								flag = 1;
								n1[m] = 0;
							}
						}
						//printf(1, "hiiiiiiiiiiiii    %s", temp);
						for (m=0; (flag < 2) && (m < 100) ; m++ ){
 50f:	83 c3 01             	add    $0x1,%ebx
 512:	83 fb 63             	cmp    $0x63,%ebx
 515:	7e d1                	jle    4e8 <main+0x3d8>
 517:	89 f3                	mov    %esi,%ebx
 519:	e9 36 fd ff ff       	jmp    254 <main+0x144>
 51e:	66 90                	xchg   %ax,%ax
				numToString(cid);
				shirshur(newString);
				fd = open(tempname, O_CREATE | O_RDWR);
				for (k = 0; k <= cid; k++){
					if (k==0){
						write(fd, "0", 1);
 520:	c7 44 24 08 01 00 00 	movl   $0x1,0x8(%esp)
 527:	00 
 528:	c7 44 24 04 cf 0c 00 	movl   $0xccf,0x4(%esp)
 52f:	00 
 530:	89 1c 24             	mov    %ebx,(%esp)
 533:	e8 d0 02 00 00       	call   808 <write>
						close(fd);
 538:	89 1c 24             	mov    %ebx,(%esp)
 53b:	e8 d0 02 00 00       	call   810 <close>
						printf(1, "FibTest<%d> <%d>,<%d>\n", cid, 0, 0);
 540:	c7 44 24 10 00 00 00 	movl   $0x0,0x10(%esp)
 547:	00 
 548:	c7 44 24 0c 00 00 00 	movl   $0x0,0xc(%esp)
 54f:	00 
 550:	e9 df fd ff ff       	jmp    334 <main+0x224>
					}
					if (k==1){
						fd = open(tempname,  O_CREATE |O_RDWR);
 555:	c7 44 24 04 02 02 00 	movl   $0x202,0x4(%esp)
 55c:	00 
 55d:	c7 04 24 c0 0d 00 00 	movl   $0xdc0,(%esp)
 564:	e8 bf 02 00 00       	call   828 <open>
						write(fd, "0\n1\n", 4);
 569:	c7 44 24 08 04 00 00 	movl   $0x4,0x8(%esp)
 570:	00 
 571:	c7 44 24 04 e8 0c 00 	movl   $0xce8,0x4(%esp)
 578:	00 
						write(fd, "0", 1);
						close(fd);
						printf(1, "FibTest<%d> <%d>,<%d>\n", cid, 0, 0);
					}
					if (k==1){
						fd = open(tempname,  O_CREATE |O_RDWR);
 579:	89 c3                	mov    %eax,%ebx
						write(fd, "0\n1\n", 4);
 57b:	89 04 24             	mov    %eax,(%esp)
 57e:	e8 85 02 00 00       	call   808 <write>
					//	read(fd, temp, 4);
					//	printf(1, temp);
						close(fd);
 583:	89 1c 24             	mov    %ebx,(%esp)
 586:	e8 85 02 00 00       	call   810 <close>
						printf(1, "FibTest<%d> <%d>,<%d>\n", cid, 0, 1);
 58b:	8b 95 00 ff ff ff    	mov    -0x100(%ebp),%edx
 591:	c7 44 24 10 01 00 00 	movl   $0x1,0x10(%esp)
 598:	00 
 599:	c7 44 24 0c 00 00 00 	movl   $0x0,0xc(%esp)
 5a0:	00 
 5a1:	c7 44 24 04 d1 0c 00 	movl   $0xcd1,0x4(%esp)
 5a8:	00 
 5a9:	89 54 24 08          	mov    %edx,0x8(%esp)
 5ad:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
 5b4:	e8 87 03 00 00       	call   940 <printf>
 5b9:	e9 94 fd ff ff       	jmp    352 <main+0x242>
 5be:	90                   	nop
 5bf:	90                   	nop

000005c0 <strcpy>:
#include "user.h"
#include "x86.h"

char*
strcpy(char *s, char *t)
{
 5c0:	55                   	push   %ebp
 5c1:	31 d2                	xor    %edx,%edx
 5c3:	89 e5                	mov    %esp,%ebp
 5c5:	8b 45 08             	mov    0x8(%ebp),%eax
 5c8:	53                   	push   %ebx
 5c9:	8b 5d 0c             	mov    0xc(%ebp),%ebx
 5cc:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  char *os;

  os = s;
  while((*s++ = *t++) != 0)
 5d0:	0f b6 0c 13          	movzbl (%ebx,%edx,1),%ecx
 5d4:	88 0c 10             	mov    %cl,(%eax,%edx,1)
 5d7:	83 c2 01             	add    $0x1,%edx
 5da:	84 c9                	test   %cl,%cl
 5dc:	75 f2                	jne    5d0 <strcpy+0x10>
    ;
  return os;
}
 5de:	5b                   	pop    %ebx
 5df:	5d                   	pop    %ebp
 5e0:	c3                   	ret    
 5e1:	eb 0d                	jmp    5f0 <strcmp>
 5e3:	90                   	nop
 5e4:	90                   	nop
 5e5:	90                   	nop
 5e6:	90                   	nop
 5e7:	90                   	nop
 5e8:	90                   	nop
 5e9:	90                   	nop
 5ea:	90                   	nop
 5eb:	90                   	nop
 5ec:	90                   	nop
 5ed:	90                   	nop
 5ee:	90                   	nop
 5ef:	90                   	nop

000005f0 <strcmp>:

int
strcmp(const char *p, const char *q)
{
 5f0:	55                   	push   %ebp
 5f1:	89 e5                	mov    %esp,%ebp
 5f3:	53                   	push   %ebx
 5f4:	8b 4d 08             	mov    0x8(%ebp),%ecx
 5f7:	8b 55 0c             	mov    0xc(%ebp),%edx
  while(*p && *p == *q)
 5fa:	0f b6 01             	movzbl (%ecx),%eax
 5fd:	84 c0                	test   %al,%al
 5ff:	75 14                	jne    615 <strcmp+0x25>
 601:	eb 25                	jmp    628 <strcmp+0x38>
 603:	90                   	nop
 604:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
    p++, q++;
 608:	83 c1 01             	add    $0x1,%ecx
 60b:	83 c2 01             	add    $0x1,%edx
}

int
strcmp(const char *p, const char *q)
{
  while(*p && *p == *q)
 60e:	0f b6 01             	movzbl (%ecx),%eax
 611:	84 c0                	test   %al,%al
 613:	74 13                	je     628 <strcmp+0x38>
 615:	0f b6 1a             	movzbl (%edx),%ebx
 618:	38 d8                	cmp    %bl,%al
 61a:	74 ec                	je     608 <strcmp+0x18>
 61c:	0f b6 db             	movzbl %bl,%ebx
 61f:	0f b6 c0             	movzbl %al,%eax
 622:	29 d8                	sub    %ebx,%eax
    p++, q++;
  return (uchar)*p - (uchar)*q;
}
 624:	5b                   	pop    %ebx
 625:	5d                   	pop    %ebp
 626:	c3                   	ret    
 627:	90                   	nop
}

int
strcmp(const char *p, const char *q)
{
  while(*p && *p == *q)
 628:	0f b6 1a             	movzbl (%edx),%ebx
 62b:	31 c0                	xor    %eax,%eax
 62d:	0f b6 db             	movzbl %bl,%ebx
 630:	29 d8                	sub    %ebx,%eax
    p++, q++;
  return (uchar)*p - (uchar)*q;
}
 632:	5b                   	pop    %ebx
 633:	5d                   	pop    %ebp
 634:	c3                   	ret    
 635:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
 639:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

00000640 <strlen>:

uint
strlen(char *s)
{
 640:	55                   	push   %ebp
  int n;

  for(n = 0; s[n]; n++)
 641:	31 d2                	xor    %edx,%edx
  return (uchar)*p - (uchar)*q;
}

uint
strlen(char *s)
{
 643:	89 e5                	mov    %esp,%ebp
  int n;

  for(n = 0; s[n]; n++)
 645:	31 c0                	xor    %eax,%eax
  return (uchar)*p - (uchar)*q;
}

uint
strlen(char *s)
{
 647:	8b 4d 08             	mov    0x8(%ebp),%ecx
  int n;

  for(n = 0; s[n]; n++)
 64a:	80 39 00             	cmpb   $0x0,(%ecx)
 64d:	74 0c                	je     65b <strlen+0x1b>
 64f:	90                   	nop
 650:	83 c2 01             	add    $0x1,%edx
 653:	80 3c 11 00          	cmpb   $0x0,(%ecx,%edx,1)
 657:	89 d0                	mov    %edx,%eax
 659:	75 f5                	jne    650 <strlen+0x10>
    ;
  return n;
}
 65b:	5d                   	pop    %ebp
 65c:	c3                   	ret    
 65d:	8d 76 00             	lea    0x0(%esi),%esi

00000660 <memset>:

void*
memset(void *dst, int c, uint n)
{
 660:	55                   	push   %ebp
 661:	89 e5                	mov    %esp,%ebp
 663:	8b 55 08             	mov    0x8(%ebp),%edx
 666:	57                   	push   %edi
}

static inline void
stosb(void *addr, int data, int cnt)
{
  asm volatile("cld; rep stosb" :
 667:	8b 4d 10             	mov    0x10(%ebp),%ecx
 66a:	8b 45 0c             	mov    0xc(%ebp),%eax
 66d:	89 d7                	mov    %edx,%edi
 66f:	fc                   	cld    
 670:	f3 aa                	rep stos %al,%es:(%edi)
  stosb(dst, c, n);
  return dst;
}
 672:	89 d0                	mov    %edx,%eax
 674:	5f                   	pop    %edi
 675:	5d                   	pop    %ebp
 676:	c3                   	ret    
 677:	89 f6                	mov    %esi,%esi
 679:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

00000680 <strchr>:

char*
strchr(const char *s, char c)
{
 680:	55                   	push   %ebp
 681:	89 e5                	mov    %esp,%ebp
 683:	8b 45 08             	mov    0x8(%ebp),%eax
 686:	0f b6 4d 0c          	movzbl 0xc(%ebp),%ecx
  for(; *s; s++)
 68a:	0f b6 10             	movzbl (%eax),%edx
 68d:	84 d2                	test   %dl,%dl
 68f:	75 11                	jne    6a2 <strchr+0x22>
 691:	eb 15                	jmp    6a8 <strchr+0x28>
 693:	90                   	nop
 694:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
 698:	83 c0 01             	add    $0x1,%eax
 69b:	0f b6 10             	movzbl (%eax),%edx
 69e:	84 d2                	test   %dl,%dl
 6a0:	74 06                	je     6a8 <strchr+0x28>
    if(*s == c)
 6a2:	38 ca                	cmp    %cl,%dl
 6a4:	75 f2                	jne    698 <strchr+0x18>
      return (char*) s;
  return 0;
}
 6a6:	5d                   	pop    %ebp
 6a7:	c3                   	ret    
}

char*
strchr(const char *s, char c)
{
  for(; *s; s++)
 6a8:	31 c0                	xor    %eax,%eax
    if(*s == c)
      return (char*) s;
  return 0;
}
 6aa:	5d                   	pop    %ebp
 6ab:	90                   	nop
 6ac:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
 6b0:	c3                   	ret    
 6b1:	eb 0d                	jmp    6c0 <atoi>
 6b3:	90                   	nop
 6b4:	90                   	nop
 6b5:	90                   	nop
 6b6:	90                   	nop
 6b7:	90                   	nop
 6b8:	90                   	nop
 6b9:	90                   	nop
 6ba:	90                   	nop
 6bb:	90                   	nop
 6bc:	90                   	nop
 6bd:	90                   	nop
 6be:	90                   	nop
 6bf:	90                   	nop

000006c0 <atoi>:
  return r;
}

int
atoi(const char *s)
{
 6c0:	55                   	push   %ebp
  int n;

  n = 0;
  while('0' <= *s && *s <= '9')
 6c1:	31 c0                	xor    %eax,%eax
  return r;
}

int
atoi(const char *s)
{
 6c3:	89 e5                	mov    %esp,%ebp
 6c5:	8b 4d 08             	mov    0x8(%ebp),%ecx
 6c8:	53                   	push   %ebx
  int n;

  n = 0;
  while('0' <= *s && *s <= '9')
 6c9:	0f b6 11             	movzbl (%ecx),%edx
 6cc:	8d 5a d0             	lea    -0x30(%edx),%ebx
 6cf:	80 fb 09             	cmp    $0x9,%bl
 6d2:	77 1c                	ja     6f0 <atoi+0x30>
 6d4:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
    n = n*10 + *s++ - '0';
 6d8:	0f be d2             	movsbl %dl,%edx
 6db:	83 c1 01             	add    $0x1,%ecx
 6de:	8d 04 80             	lea    (%eax,%eax,4),%eax
 6e1:	8d 44 42 d0          	lea    -0x30(%edx,%eax,2),%eax
atoi(const char *s)
{
  int n;

  n = 0;
  while('0' <= *s && *s <= '9')
 6e5:	0f b6 11             	movzbl (%ecx),%edx
 6e8:	8d 5a d0             	lea    -0x30(%edx),%ebx
 6eb:	80 fb 09             	cmp    $0x9,%bl
 6ee:	76 e8                	jbe    6d8 <atoi+0x18>
    n = n*10 + *s++ - '0';
  return n;
}
 6f0:	5b                   	pop    %ebx
 6f1:	5d                   	pop    %ebp
 6f2:	c3                   	ret    
 6f3:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
 6f9:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

00000700 <memmove>:

void*
memmove(void *vdst, void *vsrc, int n)
{
 700:	55                   	push   %ebp
 701:	89 e5                	mov    %esp,%ebp
 703:	56                   	push   %esi
 704:	8b 45 08             	mov    0x8(%ebp),%eax
 707:	53                   	push   %ebx
 708:	8b 5d 10             	mov    0x10(%ebp),%ebx
 70b:	8b 75 0c             	mov    0xc(%ebp),%esi
  char *dst, *src;
  
  dst = vdst;
  src = vsrc;
  while(n-- > 0)
 70e:	85 db                	test   %ebx,%ebx
 710:	7e 14                	jle    726 <memmove+0x26>
    n = n*10 + *s++ - '0';
  return n;
}

void*
memmove(void *vdst, void *vsrc, int n)
 712:	31 d2                	xor    %edx,%edx
 714:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  char *dst, *src;
  
  dst = vdst;
  src = vsrc;
  while(n-- > 0)
    *dst++ = *src++;
 718:	0f b6 0c 16          	movzbl (%esi,%edx,1),%ecx
 71c:	88 0c 10             	mov    %cl,(%eax,%edx,1)
 71f:	83 c2 01             	add    $0x1,%edx
{
  char *dst, *src;
  
  dst = vdst;
  src = vsrc;
  while(n-- > 0)
 722:	39 da                	cmp    %ebx,%edx
 724:	75 f2                	jne    718 <memmove+0x18>
    *dst++ = *src++;
  return vdst;
}
 726:	5b                   	pop    %ebx
 727:	5e                   	pop    %esi
 728:	5d                   	pop    %ebp
 729:	c3                   	ret    
 72a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi

00000730 <stat>:
  return buf;
}

int
stat(char *n, struct stat *st)
{
 730:	55                   	push   %ebp
 731:	89 e5                	mov    %esp,%ebp
 733:	83 ec 18             	sub    $0x18,%esp
  int fd;
  int r;

  fd = open(n, O_RDONLY);
 736:	8b 45 08             	mov    0x8(%ebp),%eax
  return buf;
}

int
stat(char *n, struct stat *st)
{
 739:	89 5d f8             	mov    %ebx,-0x8(%ebp)
 73c:	89 75 fc             	mov    %esi,-0x4(%ebp)
  int fd;
  int r;

  fd = open(n, O_RDONLY);
  if(fd < 0)
 73f:	be ff ff ff ff       	mov    $0xffffffff,%esi
stat(char *n, struct stat *st)
{
  int fd;
  int r;

  fd = open(n, O_RDONLY);
 744:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
 74b:	00 
 74c:	89 04 24             	mov    %eax,(%esp)
 74f:	e8 d4 00 00 00       	call   828 <open>
  if(fd < 0)
 754:	85 c0                	test   %eax,%eax
stat(char *n, struct stat *st)
{
  int fd;
  int r;

  fd = open(n, O_RDONLY);
 756:	89 c3                	mov    %eax,%ebx
  if(fd < 0)
 758:	78 19                	js     773 <stat+0x43>
    return -1;
  r = fstat(fd, st);
 75a:	8b 45 0c             	mov    0xc(%ebp),%eax
 75d:	89 1c 24             	mov    %ebx,(%esp)
 760:	89 44 24 04          	mov    %eax,0x4(%esp)
 764:	e8 d7 00 00 00       	call   840 <fstat>
  close(fd);
 769:	89 1c 24             	mov    %ebx,(%esp)
  int r;

  fd = open(n, O_RDONLY);
  if(fd < 0)
    return -1;
  r = fstat(fd, st);
 76c:	89 c6                	mov    %eax,%esi
  close(fd);
 76e:	e8 9d 00 00 00       	call   810 <close>
  return r;
}
 773:	89 f0                	mov    %esi,%eax
 775:	8b 5d f8             	mov    -0x8(%ebp),%ebx
 778:	8b 75 fc             	mov    -0x4(%ebp),%esi
 77b:	89 ec                	mov    %ebp,%esp
 77d:	5d                   	pop    %ebp
 77e:	c3                   	ret    
 77f:	90                   	nop

00000780 <gets>:
  return 0;
}

char*
gets(char *buf, int max)
{
 780:	55                   	push   %ebp
 781:	89 e5                	mov    %esp,%ebp
 783:	57                   	push   %edi
 784:	56                   	push   %esi
 785:	31 f6                	xor    %esi,%esi
 787:	53                   	push   %ebx
 788:	83 ec 2c             	sub    $0x2c,%esp
 78b:	8b 7d 08             	mov    0x8(%ebp),%edi
  int i, cc;
  char c;

  for(i=0; i+1 < max; ){
 78e:	eb 06                	jmp    796 <gets+0x16>
    cc = read(0, &c, 1);
    if(cc < 1)
      break;
    buf[i++] = c;
    if(c == '\n' || c == '\r')
 790:	3c 0a                	cmp    $0xa,%al
 792:	74 39                	je     7cd <gets+0x4d>
 794:	89 de                	mov    %ebx,%esi
gets(char *buf, int max)
{
  int i, cc;
  char c;

  for(i=0; i+1 < max; ){
 796:	8d 5e 01             	lea    0x1(%esi),%ebx
 799:	3b 5d 0c             	cmp    0xc(%ebp),%ebx
 79c:	7d 31                	jge    7cf <gets+0x4f>
    cc = read(0, &c, 1);
 79e:	8d 45 e7             	lea    -0x19(%ebp),%eax
 7a1:	c7 44 24 08 01 00 00 	movl   $0x1,0x8(%esp)
 7a8:	00 
 7a9:	89 44 24 04          	mov    %eax,0x4(%esp)
 7ad:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
 7b4:	e8 47 00 00 00       	call   800 <read>
    if(cc < 1)
 7b9:	85 c0                	test   %eax,%eax
 7bb:	7e 12                	jle    7cf <gets+0x4f>
      break;
    buf[i++] = c;
 7bd:	0f b6 45 e7          	movzbl -0x19(%ebp),%eax
 7c1:	88 44 1f ff          	mov    %al,-0x1(%edi,%ebx,1)
    if(c == '\n' || c == '\r')
 7c5:	0f b6 45 e7          	movzbl -0x19(%ebp),%eax
 7c9:	3c 0d                	cmp    $0xd,%al
 7cb:	75 c3                	jne    790 <gets+0x10>
 7cd:	89 de                	mov    %ebx,%esi
      break;
  }
  buf[i] = '\0';
 7cf:	c6 04 37 00          	movb   $0x0,(%edi,%esi,1)
  return buf;
}
 7d3:	89 f8                	mov    %edi,%eax
 7d5:	83 c4 2c             	add    $0x2c,%esp
 7d8:	5b                   	pop    %ebx
 7d9:	5e                   	pop    %esi
 7da:	5f                   	pop    %edi
 7db:	5d                   	pop    %ebp
 7dc:	c3                   	ret    
 7dd:	90                   	nop
 7de:	90                   	nop
 7df:	90                   	nop

000007e0 <fork>:
  name: \
    movl $SYS_ ## name, %eax; \
    int $T_SYSCALL; \
    ret

SYSCALL(fork)
 7e0:	b8 01 00 00 00       	mov    $0x1,%eax
 7e5:	cd 40                	int    $0x40
 7e7:	c3                   	ret    

000007e8 <exit>:
SYSCALL(exit)
 7e8:	b8 02 00 00 00       	mov    $0x2,%eax
 7ed:	cd 40                	int    $0x40
 7ef:	c3                   	ret    

000007f0 <wait>:
SYSCALL(wait)
 7f0:	b8 03 00 00 00       	mov    $0x3,%eax
 7f5:	cd 40                	int    $0x40
 7f7:	c3                   	ret    

000007f8 <pipe>:
SYSCALL(pipe)
 7f8:	b8 04 00 00 00       	mov    $0x4,%eax
 7fd:	cd 40                	int    $0x40
 7ff:	c3                   	ret    

00000800 <read>:
SYSCALL(read)
 800:	b8 06 00 00 00       	mov    $0x6,%eax
 805:	cd 40                	int    $0x40
 807:	c3                   	ret    

00000808 <write>:
SYSCALL(write)
 808:	b8 05 00 00 00       	mov    $0x5,%eax
 80d:	cd 40                	int    $0x40
 80f:	c3                   	ret    

00000810 <close>:
SYSCALL(close)
 810:	b8 07 00 00 00       	mov    $0x7,%eax
 815:	cd 40                	int    $0x40
 817:	c3                   	ret    

00000818 <kill>:
SYSCALL(kill)
 818:	b8 08 00 00 00       	mov    $0x8,%eax
 81d:	cd 40                	int    $0x40
 81f:	c3                   	ret    

00000820 <exec>:
SYSCALL(exec)
 820:	b8 09 00 00 00       	mov    $0x9,%eax
 825:	cd 40                	int    $0x40
 827:	c3                   	ret    

00000828 <open>:
SYSCALL(open)
 828:	b8 0a 00 00 00       	mov    $0xa,%eax
 82d:	cd 40                	int    $0x40
 82f:	c3                   	ret    

00000830 <mknod>:
SYSCALL(mknod)
 830:	b8 0b 00 00 00       	mov    $0xb,%eax
 835:	cd 40                	int    $0x40
 837:	c3                   	ret    

00000838 <unlink>:
SYSCALL(unlink)
 838:	b8 0c 00 00 00       	mov    $0xc,%eax
 83d:	cd 40                	int    $0x40
 83f:	c3                   	ret    

00000840 <fstat>:
SYSCALL(fstat)
 840:	b8 0d 00 00 00       	mov    $0xd,%eax
 845:	cd 40                	int    $0x40
 847:	c3                   	ret    

00000848 <link>:
SYSCALL(link)
 848:	b8 0e 00 00 00       	mov    $0xe,%eax
 84d:	cd 40                	int    $0x40
 84f:	c3                   	ret    

00000850 <mkdir>:
SYSCALL(mkdir)
 850:	b8 0f 00 00 00       	mov    $0xf,%eax
 855:	cd 40                	int    $0x40
 857:	c3                   	ret    

00000858 <chdir>:
SYSCALL(chdir)
 858:	b8 10 00 00 00       	mov    $0x10,%eax
 85d:	cd 40                	int    $0x40
 85f:	c3                   	ret    

00000860 <dup>:
SYSCALL(dup)
 860:	b8 11 00 00 00       	mov    $0x11,%eax
 865:	cd 40                	int    $0x40
 867:	c3                   	ret    

00000868 <getpid>:
SYSCALL(getpid)
 868:	b8 12 00 00 00       	mov    $0x12,%eax
 86d:	cd 40                	int    $0x40
 86f:	c3                   	ret    

00000870 <sbrk>:
SYSCALL(sbrk)
 870:	b8 13 00 00 00       	mov    $0x13,%eax
 875:	cd 40                	int    $0x40
 877:	c3                   	ret    

00000878 <sleep>:
SYSCALL(sleep)
 878:	b8 14 00 00 00       	mov    $0x14,%eax
 87d:	cd 40                	int    $0x40
 87f:	c3                   	ret    

00000880 <uptime>:
SYSCALL(uptime)
 880:	b8 15 00 00 00       	mov    $0x15,%eax
 885:	cd 40                	int    $0x40
 887:	c3                   	ret    

00000888 <wait2>:
SYSCALL(wait2)
 888:	b8 16 00 00 00       	mov    $0x16,%eax
 88d:	cd 40                	int    $0x40
 88f:	c3                   	ret    

00000890 <nice>:
SYSCALL(nice)
 890:	b8 17 00 00 00       	mov    $0x17,%eax
 895:	cd 40                	int    $0x40
 897:	c3                   	ret    
 898:	90                   	nop
 899:	90                   	nop
 89a:	90                   	nop
 89b:	90                   	nop
 89c:	90                   	nop
 89d:	90                   	nop
 89e:	90                   	nop
 89f:	90                   	nop

000008a0 <printint>:
  write(fd, &c, 1);
}

static void
printint(int fd, int xx, int base, int sgn)
{
 8a0:	55                   	push   %ebp
 8a1:	89 e5                	mov    %esp,%ebp
 8a3:	57                   	push   %edi
 8a4:	89 cf                	mov    %ecx,%edi
 8a6:	56                   	push   %esi
 8a7:	89 c6                	mov    %eax,%esi
 8a9:	53                   	push   %ebx
 8aa:	83 ec 4c             	sub    $0x4c,%esp
  char buf[16];
  int i, neg;
  uint x;

  neg = 0;
  if(sgn && xx < 0){
 8ad:	8b 4d 08             	mov    0x8(%ebp),%ecx
 8b0:	85 c9                	test   %ecx,%ecx
 8b2:	74 04                	je     8b8 <printint+0x18>
 8b4:	85 d2                	test   %edx,%edx
 8b6:	78 70                	js     928 <printint+0x88>
    neg = 1;
    x = -xx;
  } else {
    x = xx;
 8b8:	89 d0                	mov    %edx,%eax
 8ba:	c7 45 c4 00 00 00 00 	movl   $0x0,-0x3c(%ebp)
 8c1:	31 c9                	xor    %ecx,%ecx
 8c3:	8d 5d d7             	lea    -0x29(%ebp),%ebx
 8c6:	66 90                	xchg   %ax,%ax
  }

  i = 0;
  do{
    buf[i++] = digits[x % base];
 8c8:	31 d2                	xor    %edx,%edx
 8ca:	f7 f7                	div    %edi
 8cc:	0f b6 92 a3 0d 00 00 	movzbl 0xda3(%edx),%edx
 8d3:	88 14 0b             	mov    %dl,(%ebx,%ecx,1)
 8d6:	83 c1 01             	add    $0x1,%ecx
  }while((x /= base) != 0);
 8d9:	85 c0                	test   %eax,%eax
 8db:	75 eb                	jne    8c8 <printint+0x28>
  if(neg)
 8dd:	8b 45 c4             	mov    -0x3c(%ebp),%eax
 8e0:	85 c0                	test   %eax,%eax
 8e2:	74 08                	je     8ec <printint+0x4c>
    buf[i++] = '-';
 8e4:	c6 44 0d d7 2d       	movb   $0x2d,-0x29(%ebp,%ecx,1)
 8e9:	83 c1 01             	add    $0x1,%ecx

  while(--i >= 0)
 8ec:	8d 79 ff             	lea    -0x1(%ecx),%edi
 8ef:	01 fb                	add    %edi,%ebx
 8f1:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
 8f8:	0f b6 03             	movzbl (%ebx),%eax
 8fb:	83 ef 01             	sub    $0x1,%edi
 8fe:	83 eb 01             	sub    $0x1,%ebx
#include "user.h"

static void
putc(int fd, char c)
{
  write(fd, &c, 1);
 901:	c7 44 24 08 01 00 00 	movl   $0x1,0x8(%esp)
 908:	00 
 909:	89 34 24             	mov    %esi,(%esp)
    buf[i++] = digits[x % base];
  }while((x /= base) != 0);
  if(neg)
    buf[i++] = '-';

  while(--i >= 0)
 90c:	88 45 e7             	mov    %al,-0x19(%ebp)
#include "user.h"

static void
putc(int fd, char c)
{
  write(fd, &c, 1);
 90f:	8d 45 e7             	lea    -0x19(%ebp),%eax
 912:	89 44 24 04          	mov    %eax,0x4(%esp)
 916:	e8 ed fe ff ff       	call   808 <write>
    buf[i++] = digits[x % base];
  }while((x /= base) != 0);
  if(neg)
    buf[i++] = '-';

  while(--i >= 0)
 91b:	83 ff ff             	cmp    $0xffffffff,%edi
 91e:	75 d8                	jne    8f8 <printint+0x58>
    putc(fd, buf[i]);
}
 920:	83 c4 4c             	add    $0x4c,%esp
 923:	5b                   	pop    %ebx
 924:	5e                   	pop    %esi
 925:	5f                   	pop    %edi
 926:	5d                   	pop    %ebp
 927:	c3                   	ret    
  uint x;

  neg = 0;
  if(sgn && xx < 0){
    neg = 1;
    x = -xx;
 928:	89 d0                	mov    %edx,%eax
 92a:	f7 d8                	neg    %eax
 92c:	c7 45 c4 01 00 00 00 	movl   $0x1,-0x3c(%ebp)
 933:	eb 8c                	jmp    8c1 <printint+0x21>
 935:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
 939:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

00000940 <printf>:
}

// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
 940:	55                   	push   %ebp
 941:	89 e5                	mov    %esp,%ebp
 943:	57                   	push   %edi
 944:	56                   	push   %esi
 945:	53                   	push   %ebx
 946:	83 ec 3c             	sub    $0x3c,%esp
  int c, i, state;
  uint *ap;

  state = 0;
  ap = (uint*)(void*)&fmt + 1;
  for(i = 0; fmt[i]; i++){
 949:	8b 45 0c             	mov    0xc(%ebp),%eax
 94c:	0f b6 10             	movzbl (%eax),%edx
 94f:	84 d2                	test   %dl,%dl
 951:	0f 84 c9 00 00 00    	je     a20 <printf+0xe0>
  char *s;
  int c, i, state;
  uint *ap;

  state = 0;
  ap = (uint*)(void*)&fmt + 1;
 957:	8d 4d 10             	lea    0x10(%ebp),%ecx
 95a:	31 ff                	xor    %edi,%edi
 95c:	89 4d d4             	mov    %ecx,-0x2c(%ebp)
 95f:	31 db                	xor    %ebx,%ebx
#include "user.h"

static void
putc(int fd, char c)
{
  write(fd, &c, 1);
 961:	8d 75 e7             	lea    -0x19(%ebp),%esi
 964:	eb 1e                	jmp    984 <printf+0x44>
 966:	66 90                	xchg   %ax,%ax
  state = 0;
  ap = (uint*)(void*)&fmt + 1;
  for(i = 0; fmt[i]; i++){
    c = fmt[i] & 0xff;
    if(state == 0){
      if(c == '%'){
 968:	83 fa 25             	cmp    $0x25,%edx
 96b:	0f 85 b7 00 00 00    	jne    a28 <printf+0xe8>
 971:	66 bf 25 00          	mov    $0x25,%di
  int c, i, state;
  uint *ap;

  state = 0;
  ap = (uint*)(void*)&fmt + 1;
  for(i = 0; fmt[i]; i++){
 975:	83 c3 01             	add    $0x1,%ebx
 978:	0f b6 14 18          	movzbl (%eax,%ebx,1),%edx
 97c:	84 d2                	test   %dl,%dl
 97e:	0f 84 9c 00 00 00    	je     a20 <printf+0xe0>
    c = fmt[i] & 0xff;
    if(state == 0){
 984:	85 ff                	test   %edi,%edi
  uint *ap;

  state = 0;
  ap = (uint*)(void*)&fmt + 1;
  for(i = 0; fmt[i]; i++){
    c = fmt[i] & 0xff;
 986:	0f b6 d2             	movzbl %dl,%edx
    if(state == 0){
 989:	74 dd                	je     968 <printf+0x28>
      if(c == '%'){
        state = '%';
      } else {
        putc(fd, c);
      }
    } else if(state == '%'){
 98b:	83 ff 25             	cmp    $0x25,%edi
 98e:	75 e5                	jne    975 <printf+0x35>
      if(c == 'd'){
 990:	83 fa 64             	cmp    $0x64,%edx
 993:	0f 84 57 01 00 00    	je     af0 <printf+0x1b0>
        printint(fd, *ap, 10, 1);
        ap++;
      } else if(c == 'x' || c == 'p'){
 999:	83 fa 70             	cmp    $0x70,%edx
 99c:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
 9a0:	0f 84 aa 00 00 00    	je     a50 <printf+0x110>
 9a6:	83 fa 78             	cmp    $0x78,%edx
 9a9:	0f 84 a1 00 00 00    	je     a50 <printf+0x110>
        printint(fd, *ap, 16, 0);
        ap++;
      } else if(c == 's'){
 9af:	83 fa 73             	cmp    $0x73,%edx
 9b2:	0f 84 c0 00 00 00    	je     a78 <printf+0x138>
          s = "(null)";
        while(*s != 0){
          putc(fd, *s);
          s++;
        }
      } else if(c == 'c'){
 9b8:	83 fa 63             	cmp    $0x63,%edx
 9bb:	90                   	nop
 9bc:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
 9c0:	0f 84 52 01 00 00    	je     b18 <printf+0x1d8>
        putc(fd, *ap);
        ap++;
      } else if(c == '%'){
 9c6:	83 fa 25             	cmp    $0x25,%edx
 9c9:	0f 84 f9 00 00 00    	je     ac8 <printf+0x188>
#include "user.h"

static void
putc(int fd, char c)
{
  write(fd, &c, 1);
 9cf:	8b 4d 08             	mov    0x8(%ebp),%ecx
  int c, i, state;
  uint *ap;

  state = 0;
  ap = (uint*)(void*)&fmt + 1;
  for(i = 0; fmt[i]; i++){
 9d2:	83 c3 01             	add    $0x1,%ebx
#include "user.h"

static void
putc(int fd, char c)
{
  write(fd, &c, 1);
 9d5:	31 ff                	xor    %edi,%edi
 9d7:	89 55 cc             	mov    %edx,-0x34(%ebp)
 9da:	c6 45 e7 25          	movb   $0x25,-0x19(%ebp)
 9de:	c7 44 24 08 01 00 00 	movl   $0x1,0x8(%esp)
 9e5:	00 
 9e6:	89 0c 24             	mov    %ecx,(%esp)
 9e9:	89 74 24 04          	mov    %esi,0x4(%esp)
 9ed:	e8 16 fe ff ff       	call   808 <write>
 9f2:	8b 55 cc             	mov    -0x34(%ebp),%edx
 9f5:	8b 45 08             	mov    0x8(%ebp),%eax
 9f8:	c7 44 24 08 01 00 00 	movl   $0x1,0x8(%esp)
 9ff:	00 
 a00:	89 74 24 04          	mov    %esi,0x4(%esp)
 a04:	88 55 e7             	mov    %dl,-0x19(%ebp)
 a07:	89 04 24             	mov    %eax,(%esp)
 a0a:	e8 f9 fd ff ff       	call   808 <write>
 a0f:	8b 45 0c             	mov    0xc(%ebp),%eax
  int c, i, state;
  uint *ap;

  state = 0;
  ap = (uint*)(void*)&fmt + 1;
  for(i = 0; fmt[i]; i++){
 a12:	0f b6 14 18          	movzbl (%eax,%ebx,1),%edx
 a16:	84 d2                	test   %dl,%dl
 a18:	0f 85 66 ff ff ff    	jne    984 <printf+0x44>
 a1e:	66 90                	xchg   %ax,%ax
        putc(fd, c);
      }
      state = 0;
    }
  }
}
 a20:	83 c4 3c             	add    $0x3c,%esp
 a23:	5b                   	pop    %ebx
 a24:	5e                   	pop    %esi
 a25:	5f                   	pop    %edi
 a26:	5d                   	pop    %ebp
 a27:	c3                   	ret    
#include "user.h"

static void
putc(int fd, char c)
{
  write(fd, &c, 1);
 a28:	8b 45 08             	mov    0x8(%ebp),%eax
  state = 0;
  ap = (uint*)(void*)&fmt + 1;
  for(i = 0; fmt[i]; i++){
    c = fmt[i] & 0xff;
    if(state == 0){
      if(c == '%'){
 a2b:	88 55 e7             	mov    %dl,-0x19(%ebp)
#include "user.h"

static void
putc(int fd, char c)
{
  write(fd, &c, 1);
 a2e:	c7 44 24 08 01 00 00 	movl   $0x1,0x8(%esp)
 a35:	00 
 a36:	89 74 24 04          	mov    %esi,0x4(%esp)
 a3a:	89 04 24             	mov    %eax,(%esp)
 a3d:	e8 c6 fd ff ff       	call   808 <write>
 a42:	8b 45 0c             	mov    0xc(%ebp),%eax
 a45:	e9 2b ff ff ff       	jmp    975 <printf+0x35>
 a4a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
    } else if(state == '%'){
      if(c == 'd'){
        printint(fd, *ap, 10, 1);
        ap++;
      } else if(c == 'x' || c == 'p'){
        printint(fd, *ap, 16, 0);
 a50:	8b 45 d4             	mov    -0x2c(%ebp),%eax
 a53:	b9 10 00 00 00       	mov    $0x10,%ecx
        ap++;
 a58:	31 ff                	xor    %edi,%edi
    } else if(state == '%'){
      if(c == 'd'){
        printint(fd, *ap, 10, 1);
        ap++;
      } else if(c == 'x' || c == 'p'){
        printint(fd, *ap, 16, 0);
 a5a:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
 a61:	8b 10                	mov    (%eax),%edx
 a63:	8b 45 08             	mov    0x8(%ebp),%eax
 a66:	e8 35 fe ff ff       	call   8a0 <printint>
 a6b:	8b 45 0c             	mov    0xc(%ebp),%eax
        ap++;
 a6e:	83 45 d4 04          	addl   $0x4,-0x2c(%ebp)
 a72:	e9 fe fe ff ff       	jmp    975 <printf+0x35>
 a77:	90                   	nop
      } else if(c == 's'){
        s = (char*)*ap;
 a78:	8b 55 d4             	mov    -0x2c(%ebp),%edx
 a7b:	8b 3a                	mov    (%edx),%edi
        ap++;
 a7d:	83 c2 04             	add    $0x4,%edx
 a80:	89 55 d4             	mov    %edx,-0x2c(%ebp)
        if(s == 0)
 a83:	85 ff                	test   %edi,%edi
 a85:	0f 84 ba 00 00 00    	je     b45 <printf+0x205>
          s = "(null)";
        while(*s != 0){
 a8b:	0f b6 17             	movzbl (%edi),%edx
 a8e:	84 d2                	test   %dl,%dl
 a90:	74 2d                	je     abf <printf+0x17f>
 a92:	89 5d d0             	mov    %ebx,-0x30(%ebp)
 a95:	8b 5d 08             	mov    0x8(%ebp),%ebx
          putc(fd, *s);
          s++;
 a98:	83 c7 01             	add    $0x1,%edi
      } else if(c == 's'){
        s = (char*)*ap;
        ap++;
        if(s == 0)
          s = "(null)";
        while(*s != 0){
 a9b:	88 55 e7             	mov    %dl,-0x19(%ebp)
#include "user.h"

static void
putc(int fd, char c)
{
  write(fd, &c, 1);
 a9e:	c7 44 24 08 01 00 00 	movl   $0x1,0x8(%esp)
 aa5:	00 
 aa6:	89 74 24 04          	mov    %esi,0x4(%esp)
 aaa:	89 1c 24             	mov    %ebx,(%esp)
 aad:	e8 56 fd ff ff       	call   808 <write>
      } else if(c == 's'){
        s = (char*)*ap;
        ap++;
        if(s == 0)
          s = "(null)";
        while(*s != 0){
 ab2:	0f b6 17             	movzbl (%edi),%edx
 ab5:	84 d2                	test   %dl,%dl
 ab7:	75 df                	jne    a98 <printf+0x158>
 ab9:	8b 5d d0             	mov    -0x30(%ebp),%ebx
 abc:	8b 45 0c             	mov    0xc(%ebp),%eax
#include "user.h"

static void
putc(int fd, char c)
{
  write(fd, &c, 1);
 abf:	31 ff                	xor    %edi,%edi
 ac1:	e9 af fe ff ff       	jmp    975 <printf+0x35>
 ac6:	66 90                	xchg   %ax,%ax
 ac8:	8b 55 08             	mov    0x8(%ebp),%edx
 acb:	31 ff                	xor    %edi,%edi
          s++;
        }
      } else if(c == 'c'){
        putc(fd, *ap);
        ap++;
      } else if(c == '%'){
 acd:	c6 45 e7 25          	movb   $0x25,-0x19(%ebp)
#include "user.h"

static void
putc(int fd, char c)
{
  write(fd, &c, 1);
 ad1:	c7 44 24 08 01 00 00 	movl   $0x1,0x8(%esp)
 ad8:	00 
 ad9:	89 74 24 04          	mov    %esi,0x4(%esp)
 add:	89 14 24             	mov    %edx,(%esp)
 ae0:	e8 23 fd ff ff       	call   808 <write>
 ae5:	8b 45 0c             	mov    0xc(%ebp),%eax
 ae8:	e9 88 fe ff ff       	jmp    975 <printf+0x35>
 aed:	8d 76 00             	lea    0x0(%esi),%esi
      } else {
        putc(fd, c);
      }
    } else if(state == '%'){
      if(c == 'd'){
        printint(fd, *ap, 10, 1);
 af0:	8b 45 d4             	mov    -0x2c(%ebp),%eax
 af3:	b9 0a 00 00 00       	mov    $0xa,%ecx
        ap++;
 af8:	66 31 ff             	xor    %di,%di
      } else {
        putc(fd, c);
      }
    } else if(state == '%'){
      if(c == 'd'){
        printint(fd, *ap, 10, 1);
 afb:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
 b02:	8b 10                	mov    (%eax),%edx
 b04:	8b 45 08             	mov    0x8(%ebp),%eax
 b07:	e8 94 fd ff ff       	call   8a0 <printint>
 b0c:	8b 45 0c             	mov    0xc(%ebp),%eax
        ap++;
 b0f:	83 45 d4 04          	addl   $0x4,-0x2c(%ebp)
 b13:	e9 5d fe ff ff       	jmp    975 <printf+0x35>
          s = "(null)";
        while(*s != 0){
          putc(fd, *s);
          s++;
        }
      } else if(c == 'c'){
 b18:	8b 4d d4             	mov    -0x2c(%ebp),%ecx
        putc(fd, *ap);
        ap++;
 b1b:	31 ff                	xor    %edi,%edi
          s = "(null)";
        while(*s != 0){
          putc(fd, *s);
          s++;
        }
      } else if(c == 'c'){
 b1d:	8b 01                	mov    (%ecx),%eax
#include "user.h"

static void
putc(int fd, char c)
{
  write(fd, &c, 1);
 b1f:	c7 44 24 08 01 00 00 	movl   $0x1,0x8(%esp)
 b26:	00 
 b27:	89 74 24 04          	mov    %esi,0x4(%esp)
          s = "(null)";
        while(*s != 0){
          putc(fd, *s);
          s++;
        }
      } else if(c == 'c'){
 b2b:	88 45 e7             	mov    %al,-0x19(%ebp)
#include "user.h"

static void
putc(int fd, char c)
{
  write(fd, &c, 1);
 b2e:	8b 45 08             	mov    0x8(%ebp),%eax
 b31:	89 04 24             	mov    %eax,(%esp)
 b34:	e8 cf fc ff ff       	call   808 <write>
 b39:	8b 45 0c             	mov    0xc(%ebp),%eax
          putc(fd, *s);
          s++;
        }
      } else if(c == 'c'){
        putc(fd, *ap);
        ap++;
 b3c:	83 45 d4 04          	addl   $0x4,-0x2c(%ebp)
 b40:	e9 30 fe ff ff       	jmp    975 <printf+0x35>
        printint(fd, *ap, 16, 0);
        ap++;
      } else if(c == 's'){
        s = (char*)*ap;
        ap++;
        if(s == 0)
 b45:	bf 9c 0d 00 00       	mov    $0xd9c,%edi
 b4a:	e9 3c ff ff ff       	jmp    a8b <printf+0x14b>
 b4f:	90                   	nop

00000b50 <free>:
static Header base;
static Header *freep;

void
free(void *ap)
{
 b50:	55                   	push   %ebp
  Header *bp, *p;

  bp = (Header*) ap - 1;
  for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
 b51:	a1 5c 0e 00 00       	mov    0xe5c,%eax
static Header base;
static Header *freep;

void
free(void *ap)
{
 b56:	89 e5                	mov    %esp,%ebp
 b58:	57                   	push   %edi
 b59:	56                   	push   %esi
 b5a:	53                   	push   %ebx
 b5b:	8b 5d 08             	mov    0x8(%ebp),%ebx
  Header *bp, *p;

  bp = (Header*) ap - 1;
 b5e:	8d 4b f8             	lea    -0x8(%ebx),%ecx
  for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
 b61:	39 c8                	cmp    %ecx,%eax
 b63:	73 1d                	jae    b82 <free+0x32>
 b65:	8d 76 00             	lea    0x0(%esi),%esi
 b68:	8b 10                	mov    (%eax),%edx
 b6a:	39 d1                	cmp    %edx,%ecx
 b6c:	72 1a                	jb     b88 <free+0x38>
    if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
 b6e:	39 d0                	cmp    %edx,%eax
 b70:	72 08                	jb     b7a <free+0x2a>
 b72:	39 c8                	cmp    %ecx,%eax
 b74:	72 12                	jb     b88 <free+0x38>
 b76:	39 d1                	cmp    %edx,%ecx
 b78:	72 0e                	jb     b88 <free+0x38>
 b7a:	89 d0                	mov    %edx,%eax
free(void *ap)
{
  Header *bp, *p;

  bp = (Header*) ap - 1;
  for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
 b7c:	39 c8                	cmp    %ecx,%eax
 b7e:	66 90                	xchg   %ax,%ax
 b80:	72 e6                	jb     b68 <free+0x18>
 b82:	8b 10                	mov    (%eax),%edx
 b84:	eb e8                	jmp    b6e <free+0x1e>
 b86:	66 90                	xchg   %ax,%ax
    if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
      break;
  if(bp + bp->s.size == p->s.ptr){
 b88:	8b 71 04             	mov    0x4(%ecx),%esi
 b8b:	8d 3c f1             	lea    (%ecx,%esi,8),%edi
 b8e:	39 d7                	cmp    %edx,%edi
 b90:	74 19                	je     bab <free+0x5b>
    bp->s.size += p->s.ptr->s.size;
    bp->s.ptr = p->s.ptr->s.ptr;
  } else
    bp->s.ptr = p->s.ptr;
 b92:	89 53 f8             	mov    %edx,-0x8(%ebx)
  if(p + p->s.size == bp){
 b95:	8b 50 04             	mov    0x4(%eax),%edx
 b98:	8d 34 d0             	lea    (%eax,%edx,8),%esi
 b9b:	39 ce                	cmp    %ecx,%esi
 b9d:	74 23                	je     bc2 <free+0x72>
    p->s.size += bp->s.size;
    p->s.ptr = bp->s.ptr;
  } else
    p->s.ptr = bp;
 b9f:	89 08                	mov    %ecx,(%eax)
  freep = p;
 ba1:	a3 5c 0e 00 00       	mov    %eax,0xe5c
}
 ba6:	5b                   	pop    %ebx
 ba7:	5e                   	pop    %esi
 ba8:	5f                   	pop    %edi
 ba9:	5d                   	pop    %ebp
 baa:	c3                   	ret    
  bp = (Header*) ap - 1;
  for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
    if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
      break;
  if(bp + bp->s.size == p->s.ptr){
    bp->s.size += p->s.ptr->s.size;
 bab:	03 72 04             	add    0x4(%edx),%esi
 bae:	89 71 04             	mov    %esi,0x4(%ecx)
    bp->s.ptr = p->s.ptr->s.ptr;
 bb1:	8b 10                	mov    (%eax),%edx
 bb3:	8b 12                	mov    (%edx),%edx
 bb5:	89 53 f8             	mov    %edx,-0x8(%ebx)
  } else
    bp->s.ptr = p->s.ptr;
  if(p + p->s.size == bp){
 bb8:	8b 50 04             	mov    0x4(%eax),%edx
 bbb:	8d 34 d0             	lea    (%eax,%edx,8),%esi
 bbe:	39 ce                	cmp    %ecx,%esi
 bc0:	75 dd                	jne    b9f <free+0x4f>
    p->s.size += bp->s.size;
 bc2:	03 51 04             	add    0x4(%ecx),%edx
 bc5:	89 50 04             	mov    %edx,0x4(%eax)
    p->s.ptr = bp->s.ptr;
 bc8:	8b 53 f8             	mov    -0x8(%ebx),%edx
 bcb:	89 10                	mov    %edx,(%eax)
  } else
    p->s.ptr = bp;
  freep = p;
 bcd:	a3 5c 0e 00 00       	mov    %eax,0xe5c
}
 bd2:	5b                   	pop    %ebx
 bd3:	5e                   	pop    %esi
 bd4:	5f                   	pop    %edi
 bd5:	5d                   	pop    %ebp
 bd6:	c3                   	ret    
 bd7:	89 f6                	mov    %esi,%esi
 bd9:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

00000be0 <malloc>:
  return freep;
}

void*
malloc(uint nbytes)
{
 be0:	55                   	push   %ebp
 be1:	89 e5                	mov    %esp,%ebp
 be3:	57                   	push   %edi
 be4:	56                   	push   %esi
 be5:	53                   	push   %ebx
 be6:	83 ec 1c             	sub    $0x1c,%esp
  Header *p, *prevp;
  uint nunits;

  nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
 be9:	8b 5d 08             	mov    0x8(%ebp),%ebx
  if((prevp = freep) == 0){
 bec:	8b 0d 5c 0e 00 00    	mov    0xe5c,%ecx
malloc(uint nbytes)
{
  Header *p, *prevp;
  uint nunits;

  nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
 bf2:	83 c3 07             	add    $0x7,%ebx
 bf5:	c1 eb 03             	shr    $0x3,%ebx
 bf8:	83 c3 01             	add    $0x1,%ebx
  if((prevp = freep) == 0){
 bfb:	85 c9                	test   %ecx,%ecx
 bfd:	0f 84 93 00 00 00    	je     c96 <malloc+0xb6>
    base.s.ptr = freep = prevp = &base;
    base.s.size = 0;
  }
  for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
 c03:	8b 01                	mov    (%ecx),%eax
    if(p->s.size >= nunits){
 c05:	8b 50 04             	mov    0x4(%eax),%edx
 c08:	39 d3                	cmp    %edx,%ebx
 c0a:	76 1f                	jbe    c2b <malloc+0x4b>
        p->s.size -= nunits;
        p += p->s.size;
        p->s.size = nunits;
      }
      freep = prevp;
      return (void*) (p + 1);
 c0c:	8d 34 dd 00 00 00 00 	lea    0x0(,%ebx,8),%esi
 c13:	90                   	nop
 c14:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
    }
    if(p == freep)
 c18:	3b 05 5c 0e 00 00    	cmp    0xe5c,%eax
 c1e:	74 30                	je     c50 <malloc+0x70>
 c20:	89 c1                	mov    %eax,%ecx
  nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
  if((prevp = freep) == 0){
    base.s.ptr = freep = prevp = &base;
    base.s.size = 0;
  }
  for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
 c22:	8b 01                	mov    (%ecx),%eax
    if(p->s.size >= nunits){
 c24:	8b 50 04             	mov    0x4(%eax),%edx
 c27:	39 d3                	cmp    %edx,%ebx
 c29:	77 ed                	ja     c18 <malloc+0x38>
      if(p->s.size == nunits)
 c2b:	39 d3                	cmp    %edx,%ebx
 c2d:	74 61                	je     c90 <malloc+0xb0>
        prevp->s.ptr = p->s.ptr;
      else {
        p->s.size -= nunits;
 c2f:	29 da                	sub    %ebx,%edx
 c31:	89 50 04             	mov    %edx,0x4(%eax)
        p += p->s.size;
 c34:	8d 04 d0             	lea    (%eax,%edx,8),%eax
        p->s.size = nunits;
 c37:	89 58 04             	mov    %ebx,0x4(%eax)
      }
      freep = prevp;
 c3a:	89 0d 5c 0e 00 00    	mov    %ecx,0xe5c
      return (void*) (p + 1);
 c40:	83 c0 08             	add    $0x8,%eax
    }
    if(p == freep)
      if((p = morecore(nunits)) == 0)
        return 0;
  }
}
 c43:	83 c4 1c             	add    $0x1c,%esp
 c46:	5b                   	pop    %ebx
 c47:	5e                   	pop    %esi
 c48:	5f                   	pop    %edi
 c49:	5d                   	pop    %ebp
 c4a:	c3                   	ret    
 c4b:	90                   	nop
 c4c:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
morecore(uint nu)
{
  char *p;
  Header *hp;

  if(nu < 4096)
 c50:	81 fb ff 0f 00 00    	cmp    $0xfff,%ebx
 c56:	b8 00 80 00 00       	mov    $0x8000,%eax
 c5b:	bf 00 10 00 00       	mov    $0x1000,%edi
 c60:	76 04                	jbe    c66 <malloc+0x86>
 c62:	89 f0                	mov    %esi,%eax
 c64:	89 df                	mov    %ebx,%edi
    nu = 4096;
  p = sbrk(nu * sizeof(Header));
 c66:	89 04 24             	mov    %eax,(%esp)
 c69:	e8 02 fc ff ff       	call   870 <sbrk>
  if(p == (char*) -1)
 c6e:	83 f8 ff             	cmp    $0xffffffff,%eax
 c71:	74 18                	je     c8b <malloc+0xab>
    return 0;
  hp = (Header*)p;
  hp->s.size = nu;
 c73:	89 78 04             	mov    %edi,0x4(%eax)
  free((void*)(hp + 1));
 c76:	83 c0 08             	add    $0x8,%eax
 c79:	89 04 24             	mov    %eax,(%esp)
 c7c:	e8 cf fe ff ff       	call   b50 <free>
  return freep;
 c81:	8b 0d 5c 0e 00 00    	mov    0xe5c,%ecx
      }
      freep = prevp;
      return (void*) (p + 1);
    }
    if(p == freep)
      if((p = morecore(nunits)) == 0)
 c87:	85 c9                	test   %ecx,%ecx
 c89:	75 97                	jne    c22 <malloc+0x42>
  if((prevp = freep) == 0){
    base.s.ptr = freep = prevp = &base;
    base.s.size = 0;
  }
  for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
    if(p->s.size >= nunits){
 c8b:	31 c0                	xor    %eax,%eax
 c8d:	eb b4                	jmp    c43 <malloc+0x63>
 c8f:	90                   	nop
      if(p->s.size == nunits)
        prevp->s.ptr = p->s.ptr;
 c90:	8b 10                	mov    (%eax),%edx
 c92:	89 11                	mov    %edx,(%ecx)
 c94:	eb a4                	jmp    c3a <malloc+0x5a>
  Header *p, *prevp;
  uint nunits;

  nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
  if((prevp = freep) == 0){
    base.s.ptr = freep = prevp = &base;
 c96:	c7 05 5c 0e 00 00 54 	movl   $0xe54,0xe5c
 c9d:	0e 00 00 
    base.s.size = 0;
 ca0:	b9 54 0e 00 00       	mov    $0xe54,%ecx
  Header *p, *prevp;
  uint nunits;

  nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
  if((prevp = freep) == 0){
    base.s.ptr = freep = prevp = &base;
 ca5:	c7 05 54 0e 00 00 54 	movl   $0xe54,0xe54
 cac:	0e 00 00 
    base.s.size = 0;
 caf:	c7 05 58 0e 00 00 00 	movl   $0x0,0xe58
 cb6:	00 00 00 
 cb9:	e9 45 ff ff ff       	jmp    c03 <malloc+0x23>
